<?php

namespace Application\Model;

use Zend\Db\TableGateway\AbstractTableGateway;
use Zend\Db\Adapter\Adapter;
use Zend\Db\Sql\Select;
use App\Open\Recursive;
// use Zend\Db\Sql\Update;
class Menu extends AbstractTableGateway {
	protected $tableGateway;
	protected $table = 'albumss';
	protected $error = 0;
	public function __construct(Adapter $adapter) {
		$this->adapter = $adapter;
	}
	public function countItem() {
		$select = new Select ();
		$select->from ( $this->table );
		return $select;
	}
	public function fetchAll(Select $select = null) {
		if (null === $select)
			$select = new Select ();
		$select->from ( $this->table )
		       ->order ( "id DESC" );
		$resultSet = $this->selectWith ( $select );
		$resultSet->buffer ();
		//$recursive = new Recursive ( $resultSet->toArray () );
		//$recursive = $recursive->buildArray ( 0 );
		return $resultSet->toArray ();
	}
	public function Data() {
		return "Data";
	}
	public function getData() {
		return "getData";
	}
}